package weeek3.experience;

public class queue {
    public static void main(String[] args) {
        CircularArrayQueue queue1 = new CircularArrayQueue();
        String result = "";
        for (int i = 1; i <= 5; i++) {
            if (i == 1) {
                queue1.enqueue(1);
                result = "1" + "\n"; }
            if (i >= 2) {
                for (int j = 1; j <= i; j++) {
                     if (j == 1)
                        queue1.enqueue(1);
                    if (j == i) {
                        queue1.enqueue(1);
                        queue1.dequeue();
                    } if(j>=2&&j<=i-1) {
                        int h = (int) queue1.dequeue();
                        int n = h + (int) queue1.first();
                        queue1.enqueue(n);
                    }
                    }
        result+=queue1.toString()+"\n";    }
        }
        System.out.println(result);
    }
}